package function

import (
	"reflect"

	"gitee.com/knowgo/ego/core/data"
	"gitee.com/knowgo/ego/egoc"
)

type InjectValue struct {
	Value reflect.Value
	Err   error
}

type ArgContext struct {
	InjectValueMap map[reflect.Type]*InjectValue
	// GetTimeFormat  func(context.TimeFormatter) string
	ParseRequest func(service string, argument interface{}, argType *ArgumentTypeInfo, pool ArgumentPool) (reflect.Value, error)
}

func (ac *ArgContext) Reset() {
	ac.InjectValueMap = map[reflect.Type]*InjectValue{}
}

type Argument interface {
	Value(request *data.ServiceRequest, ctx *egoc.Context, argCtx *ArgContext) (reflect.Value, error)
}
